package com.ruibang.glass.produce.service.impl;

import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruibang.glass.produce.constant.Constants;
import com.ruibang.glass.produce.constant.ProduceErrorCode;
import com.ruibang.glass.produce.domain.req.DcsRealTimeDataReq;
import com.ruibang.glass.produce.domain.req.ElectricSysTrendChartReq;
import com.ruibang.glass.produce.domain.resp.dcs.yl.*;
import com.ruibang.glass.produce.mapper.DcsYlRealTimeDataMapper;
import com.ruibang.glass.produce.service.DcsYlRealTimeDataService;
import com.ruibang.glass.produce.util.DataUtil;
import com.ruibang.glass.produce.util.ExcelStyleUtils;
import com.teaming.cloud.framework2.common.exception.ServiceException;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.Nullable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.stream.Collectors;

/**
 * @Author: songJinKang
 * @CreateTime: 2024-04-23  14:57
 * @Description: TODO
 * @Version: 1.0
 */

@Slf4j
@Service
public class DcsYlRealTimeDataServiceImpl implements DcsYlRealTimeDataService {


    @Autowired
    private DcsYlRealTimeDataMapper dcsYlRealTimeDataMapper;

    @Autowired
    @Qualifier("produceThreadPool")
    private Executor executor;

    /**
     * @Description: 池炉温度数据
     * @version v1.0
     * @author songJinKang
     * @date 2024-04-23 14:59
     */
    @Override
    public IPage<TankFurnaceTemp> queryTankFurnaceTemp(DcsRealTimeDataReq dcsRealTimeDataReq) {
        //默认默认查询时间
        setDefaultTime(dcsRealTimeDataReq);
        return dcsYlRealTimeDataMapper.queryTankFurnaceTemp(new Page<>(dcsRealTimeDataReq.getPageNo(), dcsRealTimeDataReq.getPageSize()), dcsRealTimeDataReq);
    }

    /**
     * @Description:燃烧系统数据
     * @version v1.0
     * @author songJinKang
     * @date 2024-04-23 19:47
     */
    @Override
    public IPage<CombustionSystem> queryCombustionSystem(DcsRealTimeDataReq dcsRealTimeDataReq) {
        //默认默认查询时间
        setDefaultTime(dcsRealTimeDataReq);

        //查询
        IPage<CombustionSystem> page = dcsYlRealTimeDataMapper.queryCombustionSystem(new Page<>(dcsRealTimeDataReq.getPageNo(), dcsRealTimeDataReq.getPageSize()), dcsRealTimeDataReq);

        //Gas计量偏差
        if (page != null && CollectionUtils.isNotEmpty(page.getRecords())) {
            for (CombustionSystem combustionSystem : page.getRecords()) {
                if (combustionSystem.getVGasFlow() != null && combustionSystem.getRe2YLYLFTNGMonAnlVALUE() != null) {
                    Double gasFlow = combustionSystem.getVGasFlow();
                    Double re2YLYLFTNGMonAnlVALUE = combustionSystem.getRe2YLYLFTNGMonAnlVALUE();
                    double data = (gasFlow - re2YLYLFTNGMonAnlVALUE) / gasFlow * 100;
                    combustionSystem.setVGasOffset(DataUtil.formatDouble(data));
                }
            }
        }
        return page;
    }


    /**
     * @Description: 冷却水系统数据
     * @version v1.0
     * @author songJinKang
     * @date 2024-04-23 19:47
     */
    @Override
    public IPage<CoolingWaterSystem> queryCoolingWaterSystem(DcsRealTimeDataReq dcsRealTimeDataReq) {
        //默认默认查询时间
        setDefaultTime(dcsRealTimeDataReq);
        return dcsYlRealTimeDataMapper.queryCoolingWaterSystem(new Page<>(dcsRealTimeDataReq.getPageNo(), dcsRealTimeDataReq.getPageSize()), dcsRealTimeDataReq);
    }

    /**
     * @Description:电助熔系统
     * @version v1.0
     * @author songJinKang
     * @date 2024-04-23 19:47
     */
    @Override
    public IPage<ElectricAssistedMeltingSys> queryElectricAssistedMeltingSys(DcsRealTimeDataReq dcsRealTimeDataReq) {
        //默认默认查询时间
        setDefaultTime(dcsRealTimeDataReq);
        return dcsYlRealTimeDataMapper.queryElectricAssistedMeltingSys(new Page<>(dcsRealTimeDataReq.getPageNo(), dcsRealTimeDataReq.getPageSize()), dcsRealTimeDataReq);
    }

    /**
     * @Description:投料系统
     * @version v1.0
     * @author songJinKang
     * @date 2024-04-23 19:47
     */
    @Override
    public IPage<FeedingSystem> queryFeedingSystem(DcsRealTimeDataReq dcsRealTimeDataReq) {
        //默认默认查询时间
        setDefaultTime(dcsRealTimeDataReq);
        IPage<FeedingSystem> page = dcsYlRealTimeDataMapper.queryFeedingSystem(new Page<>(dcsRealTimeDataReq.getPageNo(), dcsRealTimeDataReq.getPageSize()), dcsRealTimeDataReq);
        if (page != null && CollectionUtils.isNotEmpty(page.getRecords())) {
            //处理数据
            processFeedingSysData(page.getRecords());
        }
        return page;
    }

    /**
     * @Description:池壁风机
     * @version v1.0
     * @author songJinKang
     * @date 2024-04-23 19:47
     */
    @Override
    public IPage<PoolWallFan> queryPoolWallFan(DcsRealTimeDataReq dcsRealTimeDataReq) {
        //默认默认查询时间
        setDefaultTime(dcsRealTimeDataReq);
        return dcsYlRealTimeDataMapper.queryPoolWallFan(new Page<>(dcsRealTimeDataReq.getPageNo(), dcsRealTimeDataReq.getPageSize()), dcsRealTimeDataReq);
    }

    /**
     * @Description:烟气系统
     * @version v1.0
     * @author songJinKang
     * @date 2024-04-23 19:47
     */
    @Override
    public IPage<SmokeSystem> querySmokeSystem(DcsRealTimeDataReq dcsRealTimeDataReq) {
        //默认默认查询时间
        setDefaultTime(dcsRealTimeDataReq);
        return dcsYlRealTimeDataMapper.querySmokeSystem(new Page<>(dcsRealTimeDataReq.getPageNo(), dcsRealTimeDataReq.getPageSize()), dcsRealTimeDataReq);
    }


    @Override
    public void exportTankFurnaceTemp(DcsRealTimeDataReq dcsRealTimeDataReq, HttpServletResponse response) {
        dcsRealTimeDataReq.setPageNo(-1);
        dcsRealTimeDataReq.setPageSize(-1);
        //默认频率为60分钟
        if (dcsRealTimeDataReq.getInterval() == null || dcsRealTimeDataReq.getInterval() <= 0) {
            dcsRealTimeDataReq.setInterval(60);
        }
        //导出
        IPage<TankFurnaceTemp> page = this.queryTankFurnaceTemp(dcsRealTimeDataReq);
        if (page != null && CollectionUtils.isNotEmpty(page.getRecords())) {
            try {
                EasyExcel.write(response.getOutputStream(), TankFurnaceTemp.class)
                        .registerWriteHandler(ExcelStyleUtils.createTableStyle())
                        .sheet("history_data").doWrite(page.getRecords());
            } catch (IOException e) {
                log.error("数据导出失败：{}", e.getMessage());
            }
        }
    }

    @Override
    public void exportCombustionSystem(DcsRealTimeDataReq dcsRealTimeDataReq, HttpServletResponse response) {
        dcsRealTimeDataReq.setPageNo(-1);
        dcsRealTimeDataReq.setPageSize(-1);
        //默认频率为60分钟
        if (dcsRealTimeDataReq.getInterval() == null || dcsRealTimeDataReq.getInterval() <= 0) {
            dcsRealTimeDataReq.setInterval(60);
        }
        //导出
        IPage<CombustionSystem> page = this.queryCombustionSystem(dcsRealTimeDataReq);
        if (page != null && CollectionUtils.isNotEmpty(page.getRecords())) {
            try {
                EasyExcel.write(response.getOutputStream(), CombustionSystem.class)
                        .registerWriteHandler(ExcelStyleUtils.createTableStyle())
                        .sheet("history_data").doWrite(page.getRecords());
            } catch (IOException e) {
                log.error("数据导出失败：{}", e.getMessage());
            }
        }
    }

    @Override
    public void exportCoolingWaterSystem(DcsRealTimeDataReq dcsRealTimeDataReq, HttpServletResponse response) {
        dcsRealTimeDataReq.setPageNo(-1);
        dcsRealTimeDataReq.setPageSize(-1);
        //默认频率为60分钟
        if (dcsRealTimeDataReq.getInterval() == null || dcsRealTimeDataReq.getInterval() <= 0) {
            dcsRealTimeDataReq.setInterval(60);
        }
        //导出
        IPage<CoolingWaterSystem> page = this.queryCoolingWaterSystem(dcsRealTimeDataReq);
        if (page != null && CollectionUtils.isNotEmpty(page.getRecords())) {
            try {
                EasyExcel.write(response.getOutputStream(), CoolingWaterSystem.class)
                        .registerWriteHandler(ExcelStyleUtils.createTableStyle())
                        .sheet("history_data").doWrite(page.getRecords());
            } catch (IOException e) {
                log.error("数据导出失败：{}", e.getMessage());
            }
        }
    }

    @Override
    public void exportElectricAssistedMeltingSys(DcsRealTimeDataReq dcsRealTimeDataReq, HttpServletResponse response) {
        dcsRealTimeDataReq.setPageNo(-1);
        dcsRealTimeDataReq.setPageSize(-1);
        //默认频率为60分钟
        if (dcsRealTimeDataReq.getInterval() == null || dcsRealTimeDataReq.getInterval() <= 0) {
            dcsRealTimeDataReq.setInterval(60);
        }
        //导出
        IPage<ElectricAssistedMeltingSys> page = this.queryElectricAssistedMeltingSys(dcsRealTimeDataReq);
        if (page != null && CollectionUtils.isNotEmpty(page.getRecords())) {
            try {
                EasyExcel.write(response.getOutputStream(), ElectricAssistedMeltingSys.class)
                        .registerWriteHandler(ExcelStyleUtils.createTableStyle())
                        .sheet("history_data").doWrite(page.getRecords());
            } catch (IOException e) {
                log.error("数据导出失败：{}", e.getMessage());
            }
        }
    }

    @Override
    public void exportFeedingSystem(DcsRealTimeDataReq dcsRealTimeDataReq, HttpServletResponse response) {
        dcsRealTimeDataReq.setPageNo(-1);
        dcsRealTimeDataReq.setPageSize(-1);
        //默认频率为60分钟
        if (dcsRealTimeDataReq.getInterval() == null || dcsRealTimeDataReq.getInterval() <= 0) {
            dcsRealTimeDataReq.setInterval(60);
        }
        //导出
        IPage<FeedingSystem> page = this.queryFeedingSystem(dcsRealTimeDataReq);
        if (page != null && CollectionUtils.isNotEmpty(page.getRecords())) {
            try {
                EasyExcel.write(response.getOutputStream(), FeedingSystem.class)
                        .registerWriteHandler(ExcelStyleUtils.createTableStyle())
                        .sheet("history_data").doWrite(page.getRecords());
            } catch (IOException e) {
                log.error("数据导出失败：{}", e.getMessage());
            }
        }
    }

    @Override
    public void exportPoolWallFan(DcsRealTimeDataReq dcsRealTimeDataReq, HttpServletResponse response) {
        dcsRealTimeDataReq.setPageNo(-1);
        dcsRealTimeDataReq.setPageSize(-1);
        //默认频率为60分钟
        if (dcsRealTimeDataReq.getInterval() == null || dcsRealTimeDataReq.getInterval() <= 0) {
            dcsRealTimeDataReq.setInterval(60);
        }
        //导出
        IPage<PoolWallFan> page = this.queryPoolWallFan(dcsRealTimeDataReq);
        if (page != null && CollectionUtils.isNotEmpty(page.getRecords())) {
            try {
                EasyExcel.write(response.getOutputStream(), PoolWallFan.class)
                        .registerWriteHandler(ExcelStyleUtils.createTableStyle())
                        .sheet("history_data").doWrite(page.getRecords());
            } catch (IOException e) {
                log.error("数据导出失败：{}", e.getMessage());
            }
        }
    }

    @Override
    public void exportSmokeSystem(DcsRealTimeDataReq dcsRealTimeDataReq, HttpServletResponse response) {
        dcsRealTimeDataReq.setPageNo(-1);
        dcsRealTimeDataReq.setPageSize(-1);
        //默认频率为60分钟
        if (dcsRealTimeDataReq.getInterval() == null || dcsRealTimeDataReq.getInterval() <= 0) {
            dcsRealTimeDataReq.setInterval(60);
        }
        //导出
        IPage<SmokeSystem> page = this.querySmokeSystem(dcsRealTimeDataReq);
        if (page != null && CollectionUtils.isNotEmpty(page.getRecords())) {
            try {
                EasyExcel.write(response.getOutputStream(), SmokeSystem.class)
                        .registerWriteHandler(ExcelStyleUtils.createTableStyle())
                        .sheet("history_data").doWrite(page.getRecords());
            } catch (IOException e) {
                log.error("数据导出失败：{}", e.getMessage());
            }
        }
    }

    @Override
    public TankFurnaceTempTrendChart tankFurnaceTempTrendChart(DcsRealTimeDataReq dcsRealTimeDataReq) {
        //默认时间
        if (dcsRealTimeDataReq.getStartTime() == null || dcsRealTimeDataReq.getEndTime() == null) {
            LocalDateTime endTime = LocalDateTime.now();
            LocalDateTime startTime = endTime.minusDays(3);
            dcsRealTimeDataReq.setStartTime(startTime);
            dcsRealTimeDataReq.setEndTime(endTime);
        }
        //查询池炉温度数据
        List<TankFurnaceTemp> tankFurnaceTempList = dcsYlRealTimeDataMapper.tankFurnaceTempTrendChart(dcsRealTimeDataReq);
        TankFurnaceTempTrendChart tankFurnaceTempTrendChart = new TankFurnaceTempTrendChart();

        if (CollectionUtils.isNotEmpty(tankFurnaceTempList)) {
            //采集时间
            List<String> collectTime = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLA15MonAnlTIMESTAMP).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setCollectTime(collectTime);


            // c1mt     Re2YLYLTTAT01MonAnlVALUE
            List<Double> c1mt = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT01MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setC1mt(c1mt);
            // c2mt     Re2YLYLTTAT02MonAnlVALUE
            List<Double> c2mt = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT02MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setC2mt(c2mt);
            // c3mt     Re2YLYLTTAT03MonAnlVALUE
            List<Double> c3mt = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT03MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setC3mt(c3mt);
            // c4mt     Re2YLYLTTAT04MonAnlVALUE
            List<Double> c4mt = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT04MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setC4mt(c4mt);
            // c5mt     Re2YLYLTTAT05MonAnlVALUE
            List<Double> c5mt = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT05MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setC5mt(c5mt);
            // c6mt     Re2YLYLTTAT06MonAnlVALUE
            List<Double> c6mt = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT06MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setC6mt(c6mt);
            // c7mt     Re2YLYLTTAT07MonAnlVALUE
            List<Double> c7mt = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT07MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setC7mt(c7mt);
            // c8mt     Re2YLYLTTAT08MonAnlVALUE
            List<Double> c8mt = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT08MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setC8mt(c8mt);


            // b1mt     Re2YLYLTTAT17MonAnlVALUE
            List<Double> b1mt = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT17MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setB1mt(b1mt);
            // b2mt     Re2YLYLTTAT18MonAnlVALUE
            List<Double> b2mt = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT18MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setB2mt(b2mt);
            // b3mt     Re2YLYLTTAT19MonAnlVALUE
            List<Double> b3mt = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT19MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setB3mt(b3mt);
            // b4mt     Re2YLYLTTAT20MonAnlVALUE
            List<Double> b4mt = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT20MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setB4mt(b4mt);
            // b5mt     Re2YLYLTTAT21MonAnlVALUE
            List<Double> b5mt = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT21MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setB5mt(b5mt);
            // b6mt     Re2YLYLTTAT22MonAnlVALUE
            List<Double> b6mt = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT22MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setB6mt(b6mt);
            // b7mt     Re2YLYLTTAT23MonAnlVALUE
            List<Double> b7mt = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT23MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setB7mt(b7mt);
            // b8mt     Re2YLYLTTAT24MonAnlVALUE
            List<Double> b8mt = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT24MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setB8mt(b8mt);


            // b1at     Re2YLYLTTAT25MonAnlVALUE
            List<Double> b1at = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT25MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setB1at(b1at);
            // b2at     Re2YLYLTTAT26MonAnlVALUE
            List<Double> b2at = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT26MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setB2at(b2at);
            // b3at     Re2YLYLTTAT27MonAnlVALUE
            List<Double> b3at = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT27MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setB3at(b3at);
            // b4at     Re2YLYLTTAT28MonAnlVALUE
            List<Double> b4at = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT28MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setB4at(b4at);
            // b5at     Re2YLYLTTAT29MonAnlVALUE
            List<Double> b5at = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT29MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setB5at(b5at);
            // b6at     Re2YLYLTTAT30MonAnlVALUE
            List<Double> b6at = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT30MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setB6at(b6at);
            // b7at     Re2YLYLTTAT31MonAnlVALUE
            List<Double> b7at = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT31MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setB7at(b7at);
            // b8at     Re2YLYLTTAT32MonAnlVALUE
            List<Double> b8at = tankFurnaceTempList.stream().map(TankFurnaceTemp::getRe2YLYLTTAT32MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
            tankFurnaceTempTrendChart.setB8at(b8at);
        }

        return tankFurnaceTempTrendChart;
    }

    @Override
    public FeedingSystemTrendChart feedingSystemTrendChart(DcsRealTimeDataReq dcsRealTimeDataReq) {
        //默认时间
        if (dcsRealTimeDataReq.getStartTime() == null || dcsRealTimeDataReq.getEndTime() == null) {
            LocalDateTime endTime = LocalDateTime.now();
            LocalDateTime startTime = endTime.minusDays(7);
            dcsRealTimeDataReq.setStartTime(startTime);
            dcsRealTimeDataReq.setEndTime(endTime);
        }

        FeedingSystemTrendChart feedingSystemTrendChart = new FeedingSystemTrendChart();

        //图一
        CompletableFuture<Void> taskOne = CompletableFuture.runAsync(() -> {
            List<FeedingSystem> chartOneData = dcsYlRealTimeDataMapper.feedingSystemChartOne(dcsRealTimeDataReq);
            if (CollectionUtils.isNotEmpty(chartOneData)) {
                //图一采集时间
                List<String> collectTime = chartOneData.stream().map(FeedingSystem::getRe2YLYLA15MonAnlTIMESTAMP).collect(Collectors.toList());
                feedingSystemTrendChart.setChartOneCollectTime(collectTime);
                //A侧二级螺旋频率 Re2YLYLFKAMonAnlVALUE
                List<Double> re2YLYLFKAMonAnlVALUE = chartOneData.stream().map(FeedingSystem::getRe2YLYLFKAMonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
                feedingSystemTrendChart.setChartOneRe2YLYLFKAMonAnlVALUE(re2YLYLFKAMonAnlVALUE);
                //B侧二级螺旋频率 Re2YLYLFKBMonAnlVALUE
                List<Double> re2YLYLFKBMonAnlVALUE = chartOneData.stream().map(FeedingSystem::getRe2YLYLFKBMonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
                feedingSystemTrendChart.setChartOneRe2YLYLFKBMonAnlVALUE(re2YLYLFKBMonAnlVALUE);
                //液位高度（mm） Re2YLYLYWTD01MonAnlVALUE
                List<Double> re2YLYLYWTD01MonAnlVALUE = chartOneData.stream().map(FeedingSystem::getRe2YLYLYWTD01MonAnlVALUE).filter(Objects::nonNull).collect(Collectors.toList());
                feedingSystemTrendChart.setChartOneRe2YLYLYWTD01MonAnlVALUE(re2YLYLYWTD01MonAnlVALUE);
            }
        }, executor);

        //图二
        CompletableFuture<Void> taskTwo = CompletableFuture.runAsync(() -> {
            DcsRealTimeDataReq req = new DcsRealTimeDataReq();
            LocalDate startDate = dcsRealTimeDataReq.getStartTime().toLocalDate();
            LocalDate endDate = dcsRealTimeDataReq.getEndTime().toLocalDate();
            LocalDateTime startTime = LocalDateTime.of(startDate.getYear(), startDate.getMonthValue(), startDate.getDayOfMonth(), dcsRealTimeDataReq.getStartTime().getHour(), 0, 0).minusHours(1);
            LocalDateTime endTime = LocalDateTime.of(endDate.getYear(), endDate.getMonthValue(), endDate.getDayOfMonth(), dcsRealTimeDataReq.getEndTime().getHour(), 0, 0).plusDays(1);
            req.setStartTime(startTime);
            req.setEndTime(endTime);
            List<FeedingSystem> feedingSystemList = dcsYlRealTimeDataMapper.feedingSystemTrendChart(req);
            if (CollectionUtils.isNotEmpty(feedingSystemList)) {
                //处理数据
                feedingSystemList = feedingSystemList.stream().sorted(Comparator.comparing(FeedingSystem::getCollectTime).reversed()).collect(Collectors.toList());
                processFeedingSysData(feedingSystemList);
                feedingSystemList.remove(feedingSystemList.size() - 1);
                //图二采集时间
                feedingSystemList = feedingSystemList.stream().sorted(Comparator.comparing(FeedingSystem::getCollectTime)).collect(Collectors.toList());
                List<String> collectTime = feedingSystemList.stream().map(FeedingSystem::getCollectTime).collect(Collectors.toList());
                feedingSystemTrendChart.setChartTwoCollectTime(collectTime);
                //A侧投料量 (根据累计流量) vAFeed
                List<Double> vAFeed = feedingSystemList.stream().map(FeedingSystem::getVAFeed).filter(Objects::nonNull).collect(Collectors.toList());
                feedingSystemTrendChart.setChartTwoVAFeed(vAFeed);
                //B侧投料量 (根据累计流量) vBFeed
                List<Double> vBFeed = feedingSystemList.stream().map(FeedingSystem::getVBFeed).filter(Objects::nonNull).collect(Collectors.toList());
                feedingSystemTrendChart.setChartTwoVBFeed(vBFeed);
                //累计加料量(根据累计流量) vTotalFeed
                List<Double> vTotalFeed = feedingSystemList.stream().map(FeedingSystem::getVTotalFeed).filter(Objects::nonNull).collect(Collectors.toList());
                feedingSystemTrendChart.setChartTwoVTotalFeed(vTotalFeed);
                //玻璃液生成速度(累计值) vGlassTotal
                List<Double> vGlassTotal = feedingSystemList.stream().map(FeedingSystem::getVGlassTotal).filter(Objects::nonNull).collect(Collectors.toList());
                feedingSystemTrendChart.setChartTwoVGlassTotal(vGlassTotal);
            }
        }, executor);

        //等待
        CompletableFuture.allOf(taskOne, taskTwo).join();
        return feedingSystemTrendChart;
    }

    @Override
    public ElectricSysTrendChart electricAssistedMeltingSysTrendChart(ElectricSysTrendChartReq electricSysTrendChartReq) {
        //默认时间
        if (electricSysTrendChartReq.getStartTime() == null || electricSysTrendChartReq.getEndTime() == null) {
            LocalDateTime endTime = LocalDateTime.now();
            LocalDateTime startTime = endTime.minusDays(7);
            electricSysTrendChartReq.setStartTime(startTime);
            electricSysTrendChartReq.setEndTime(endTime);
        }
        List<ElectricAssistedMeltingSys> electricData = dcsYlRealTimeDataMapper.electricAssistedMeltingSysTrendChart(electricSysTrendChartReq);
        ElectricSysTrendChart electricSysTrendChart = new ElectricSysTrendChart();
        if (CollectionUtils.isNotEmpty(electricData)) {
            //采集时间
            List<String> collectTime = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLA15MonAnlTIMESTAMP).collect(Collectors.toList());
            electricSysTrendChart.setRe2YLYLA15MonAnlTIMESTAMP(collectTime);
            switch (electricSysTrendChartReq.getType()) {
                case Constants.ONE_STR: {
                    /**
                     * 电阻
                     */
                    //1区电极电阻率 （Ω*CM） Re2YLYLTSX1RESITVALUE
                    List<Double> re2YLYLTSX1RESITVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTSX1RESITVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTSX1RESITVALUE(re2YLYLTSX1RESITVALUE);
                    //2区电极电阻率 （Ω*CM） Re2YLYLTSX2RESITVALUE
                    List<Double> re2YLYLTSX2RESITVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTSX2RESITVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTSX2RESITVALUE(re2YLYLTSX2RESITVALUE);
                    //3区电极电阻率 （Ω*CM） Re2YLYLTSX3RESITVALUE
                    List<Double> re2YLYLTSX3RESITVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTSX3RESITVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTSX3RESITVALUE(re2YLYLTSX3RESITVALUE);
                    //4区电极电阻率 （Ω*CM） Re2YLYLTSX4RESITVALUE
                    List<Double> re2YLYLTSX4RESITVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTSX4RESITVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTSX4RESITVALUE(re2YLYLTSX4RESITVALUE);
                    //5区电极电阻率 （Ω*CM） Re2YLYLTSX5RESITVALUE
                    List<Double> re2YLYLTSX5RESITVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTSX5RESITVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTSX5RESITVALUE(re2YLYLTSX5RESITVALUE);
                    //6区电极电阻率 （Ω*CM） Re2YLYLTSX6RESITVALUE
                    List<Double> re2YLYLTSX6RESITVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTSX6RESITVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTSX6RESITVALUE(re2YLYLTSX6RESITVALUE);
                    //7区电极电阻率 （Ω*CM） Re2YLYLTSX7RESITVALUE
                    List<Double> re2YLYLTSX7RESITVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTSX7RESITVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTSX7RESITVALUE(re2YLYLTSX7RESITVALUE);
                    //8区电极电阻率 （Ω*CM） Re2YLYLTSX8RESITVALUE
                    List<Double> re2YLYLTSX8RESITVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTSX8RESITVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTSX8RESITVALUE(re2YLYLTSX8RESITVALUE);
                    return electricSysTrendChart;
                }
                case Constants.TWO_STR: {
                    /**
                     * 开度
                     */
                    //1区电极开度  Re2YLYLSCR1AlpPERVALUE
                    List<Double> re2YLYLSCR1AlpPERVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLSCR1AlpPERVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLSCR1AlpPERVALUE(re2YLYLSCR1AlpPERVALUE);
                    //2区电极开度  Re2YLYLSCR2AlpPERVALUE
                    List<Double> re2YLYLSCR2AlpPERVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLSCR2AlpPERVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLSCR2AlpPERVALUE(re2YLYLSCR2AlpPERVALUE);
                    //3区电极开度  Re2YLYLSCR3AlpPERVALUE
                    List<Double> re2YLYLSCR3AlpPERVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLSCR3AlpPERVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLSCR3AlpPERVALUE(re2YLYLSCR3AlpPERVALUE);
                    //4区电极开度  Re2YLYLSCR4AlpPERVALUE
                    List<Double> re2YLYLSCR4AlpPERVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLSCR4AlpPERVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLSCR4AlpPERVALUE(re2YLYLSCR4AlpPERVALUE);
                    //5区电极开度  Re2YLYLSCR5AlpPERVALUE
                    List<Double> re2YLYLSCR5AlpPERVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLSCR5AlpPERVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLSCR5AlpPERVALUE(re2YLYLSCR5AlpPERVALUE);
                    //6区电极开度  Re2YLYLSCR6AlpPERVALUE
                    List<Double> re2YLYLSCR6AlpPERVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLSCR6AlpPERVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLSCR6AlpPERVALUE(re2YLYLSCR6AlpPERVALUE);
                    //7区电极开度  Re2YLYLSCR7AlpPERVALUE
                    List<Double> re2YLYLSCR7AlpPERVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLSCR7AlpPERVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLSCR7AlpPERVALUE(re2YLYLSCR7AlpPERVALUE);
                    //8区电极开度  Re2YLYLSCR8AlpPERVALUE
                    List<Double> re2YLYLSCR8AlpPERVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLSCR8AlpPERVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLSCR8AlpPERVALUE(re2YLYLSCR8AlpPERVALUE);
                    return electricSysTrendChart;
                }
                case Constants.THREE_STR: {
                    /**
                     * 电流
                     */
                    //1区电极二次侧电流（A）  Re2YLYLTXS12IaVALUE
                    List<Double> re2YLYLTXS12IaVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS12IaVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS12IaVALUE(re2YLYLTXS12IaVALUE);
                    //2区电极二次侧电流（A）  Re2YLYLTXS22IaVALUE
                    List<Double> re2YLYLTXS22IaVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS22IaVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS22IaVALUE(re2YLYLTXS22IaVALUE);
                    //3区电极二次侧电流（A）  Re2YLYLTXS32IaVALUE
                    List<Double> re2YLYLTXS32IaVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS32IaVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS32IaVALUE(re2YLYLTXS32IaVALUE);
                    //4区电极二次侧电流（A）  Re2YLYLTXS42IaVALUE
                    List<Double> re2YLYLTXS42IaVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS42IaVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS42IaVALUE(re2YLYLTXS42IaVALUE);
                    //5区电极二次侧电流（A）  Re2YLYLTXS52IaVALUE
                    List<Double> re2YLYLTXS52IaVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS52IaVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS52IaVALUE(re2YLYLTXS52IaVALUE);
                    //6区电极二次侧电流（A）  Re2YLYLTXS62IaVALUE
                    List<Double> re2YLYLTXS62IaVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS62IaVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS62IaVALUE(re2YLYLTXS62IaVALUE);
                    //7区电极二次侧电流（A）  Re2YLYLTXS72IaVALUE
                    List<Double> re2YLYLTXS72IaVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS72IaVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS72IaVALUE(re2YLYLTXS72IaVALUE);
                    //8区电极二次侧电流（A）  Re2YLYLTXS82IaVALUE
                    List<Double> re2YLYLTXS82IaVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS82IaVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS82IaVALUE(re2YLYLTXS82IaVALUE);
                    return electricSysTrendChart;
                }
                case Constants.FOUR_STR: {
                    /**
                     * 功率
                     */
                    //1区电极二次侧功率（KW）  Re2YLYLTXS12KVAVALUE
                    List<Double> re2YLYLTXS12KVAVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS12KVAVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS12KVAVALUE(re2YLYLTXS12KVAVALUE);
                    //2区电极二次侧功率（KW）  Re2YLYLTXS22KVAVALUE
                    List<Double> re2YLYLTXS22KVAVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS22KVAVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS22KVAVALUE(re2YLYLTXS22KVAVALUE);
                    //3区电极二次侧功率（KW）  Re2YLYLTXS32KVAVALUE
                    List<Double> re2YLYLTXS32KVAVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS32KVAVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS32KVAVALUE(re2YLYLTXS32KVAVALUE);
                    //4区电极二次侧功率（KW）  Re2YLYLTXS42KVAVALUE
                    List<Double> re2YLYLTXS42KVAVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS42KVAVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS42KVAVALUE(re2YLYLTXS42KVAVALUE);
                    //5区电极二次侧功率（KW）  Re2YLYLTXS52KVAVALUE
                    List<Double> re2YLYLTXS52KVAVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS52KVAVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS52KVAVALUE(re2YLYLTXS52KVAVALUE);
                    //6区电极二次侧功率（KW）  Re2YLYLTXS62KVAVALUE
                    List<Double> re2YLYLTXS62KVAVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS62KVAVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS62KVAVALUE(re2YLYLTXS62KVAVALUE);
                    //7区电极二次侧功率（KW）  Re2YLYLTXS72KVAVALUE
                    List<Double> re2YLYLTXS72KVAVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS72KVAVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS72KVAVALUE(re2YLYLTXS72KVAVALUE);
                    //8区电极二次侧功率（KW）  Re2YLYLTXS82KVAVALUE
                    List<Double> re2YLYLTXS82KVAVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS82KVAVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS82KVAVALUE(re2YLYLTXS82KVAVALUE);
                    return electricSysTrendChart;
                }
                case Constants.FIVE_STR: {
                    /**
                     * 电压
                     */
                    //1区电极二次侧电压（V）  Re2YLYLTXS12UabVALUE
                    List<Double> re2YLYLTXS12UabVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS12UabVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS12UabVALUE(re2YLYLTXS12UabVALUE);
                    //2区电极二次侧电压（V）  Re2YLYLTXS22UabVALUE
                    List<Double> re2YLYLTXS22UabVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS22UabVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS22UabVALUE(re2YLYLTXS22UabVALUE);
                    //3区电极二次侧电压（V）  Re2YLYLTXS32UabVALUE
                    List<Double> re2YLYLTXS32UabVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS32UabVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS32UabVALUE(re2YLYLTXS32UabVALUE);
                    //4区电极二次侧电压（V）  Re2YLYLTXS42UabVALUE
                    List<Double> re2YLYLTXS42UabVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS42UabVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS42UabVALUE(re2YLYLTXS42UabVALUE);
                    //5区电极二次侧电压（V）  Re2YLYLTXS52UabVALUE
                    List<Double> re2YLYLTXS52UabVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS52UabVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS52UabVALUE(re2YLYLTXS52UabVALUE);
                    //6区电极二次侧电压（V）  Re2YLYLTXS62UabVALUE
                    List<Double> re2YLYLTXS62UabVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS62UabVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS62UabVALUE(re2YLYLTXS62UabVALUE);
                    //7区电极二次侧电压（V）  Re2YLYLTXS72UabVALUE
                    List<Double> re2YLYLTXS72UabVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS72UabVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS72UabVALUE(re2YLYLTXS72UabVALUE);
                    //8区电极二次侧电压（V）  Re2YLYLTXS82UabVALUE
                    List<Double> re2YLYLTXS82UabVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXS82UabVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXS82UabVALUE(re2YLYLTXS82UabVALUE);
                    return electricSysTrendChart;
                }
                case Constants.SIX_STR: {
                    /**
                     * 平均电阻/总功率
                     */
                    //总功率(KW)  Re2YLYLTXSTotalKWVALUE
                    List<Double> re2YLYLTXSTotalKWVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLTXSTotalKWVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLTXSTotalKWVALUE(re2YLYLTXSTotalKWVALUE);
                    //平均电阻率Ω*CM  Re2YLYLAVERRESITVALUE
                    List<Double> re2YLYLAVERRESITVALUE = electricData.stream().map(ElectricAssistedMeltingSys::getRe2YLYLAVERRESITVALUE).collect(Collectors.toList());
                    electricSysTrendChart.setRe2YLYLAVERRESITVALUE(re2YLYLAVERRESITVALUE);
                    return electricSysTrendChart;
                }
                default: {
                    throw new ServiceException(ProduceErrorCode.UNKNOWN_TREND_CHART_TYPE.getCode(), ProduceErrorCode.UNKNOWN_TREND_CHART_TYPE.getMsg());
                }
            }
        }
        return electricSysTrendChart;
    }

    @Nullable
    private void setDefaultTime(DcsRealTimeDataReq dcsRealTimeDataReq) {
        if (dcsRealTimeDataReq.getStartTime() == null || dcsRealTimeDataReq.getEndTime() == null) {
            LocalDateTime endTime = LocalDateTime.now();
            LocalDateTime startTime = endTime.minusDays(7);
            dcsRealTimeDataReq.setStartTime(startTime);
            dcsRealTimeDataReq.setEndTime(endTime);
        }
    }


    private void processFeedingSysData(List<FeedingSystem> records) {
        for (int i = 0; i < records.size(); i++) {
            if (i < records.size() - 1) {
                //vAFeed   A侧投料量 (根据累计流量)
                FeedingSystem feedingSystem = records.get(i);
                FeedingSystem lastFeedingSystem = records.get(i + 1);
                if (feedingSystem.getRe2YLYLylxzA16MonAnlVALUE() != null && lastFeedingSystem.getRe2YLYLA15MonAnlVALUE() != null) {
                    Double current = feedingSystem.getRe2YLYLylxzA16MonAnlVALUE();
                    Double last = lastFeedingSystem.getRe2YLYLylxzA16MonAnlVALUE();
                    feedingSystem.setVAFeed(DataUtil.formatDouble(current - last));
                }
                //vAFeed2   A侧投料量 (根据料仓重量)
                if (feedingSystem.getRe2YLYLA15MonAnlVALUE() != null && lastFeedingSystem.getRe2YLYLA15MonAnlVALUE() != null) {
                    Double current = feedingSystem.getRe2YLYLA15MonAnlVALUE();
                    Double last = lastFeedingSystem.getRe2YLYLA15MonAnlVALUE();
                    feedingSystem.setVAFeed2(DataUtil.formatDouble(last - current));
                }
                //vBFeed B侧投料量 (根据累计流量)
                if (feedingSystem.getRe2YLYLylxzB16MonAnlVALUE() != null && lastFeedingSystem.getRe2YLYLylxzB16MonAnlVALUE() != null) {
                    Double current = feedingSystem.getRe2YLYLylxzB16MonAnlVALUE();
                    Double last = lastFeedingSystem.getRe2YLYLylxzB16MonAnlVALUE();
                    feedingSystem.setVBFeed(DataUtil.formatDouble(current - last));
                }
                //vBFeed2 B侧投料量 (根据料仓重量)
                if (feedingSystem.getRe2YLYLB15MonAnlVALUE() != null && lastFeedingSystem.getRe2YLYLB15MonAnlVALUE() != null) {
                    Double current = feedingSystem.getRe2YLYLB15MonAnlVALUE();
                    Double last = lastFeedingSystem.getRe2YLYLB15MonAnlVALUE();
                    feedingSystem.setVBFeed2(DataUtil.formatDouble(last - current));
                }
                //vTotalFeed 累计加料量(根据累计流量)
                if (feedingSystem.getVAFeed() != null && feedingSystem.getVBFeed() != null) {
                    double vTotalFeed = feedingSystem.getVAFeed() + feedingSystem.getVBFeed();
                    feedingSystem.setVTotalFeed(vTotalFeed);
                    //vGlassTotal 玻璃液生成速度(累计值)
                    feedingSystem.setVGlassTotal(DataUtil.formatDouble(vTotalFeed * 0.9019));
                }
                //vTotalFeed2 累计加料量(根据料仓重量)
                if (feedingSystem.getVAFeed2() != null && feedingSystem.getVBFeed2() != null) {
                    double vTotalFeed2 = feedingSystem.getVAFeed2() + feedingSystem.getVBFeed2();
                    feedingSystem.setVTotalFeed2(DataUtil.formatDouble(vTotalFeed2));
                    //vGlassTotal2 玻璃液生成速度(仓重值)
                    feedingSystem.setVGlassTotal2(DataUtil.formatDouble(vTotalFeed2 * 0.9019));
                }
            }
        }
    }
}
